package com.woniuxy.stage3demo.mapper.hpxmapper;

import com.woniuxy.stage3demo.bean.hpxbean.ContractBean;
import com.woniuxy.stage3demo.pageHelper.PageRequest;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ContractMapper {

    /**
     * 分页查询
     * @param request    分页请求对象
     * @param contractBean  判断条件，传入参数对象
     * @return
     */
    List<ContractBean> findAllByParams(@Param("p") PageRequest request, @Param("c") ContractBean contractBean);

    //今日合同数查询
    @Select("select count(*) from contract where complet_time= curdate()")
    int todayContract();

    //近7日合同数查询
    @Select("select count(*) from contract where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= complet_time")
    int weekContracts();

    //近30日合同数查询
    @Select("select count(*) from contract where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= complet_time")
    int monthContracts();

    //总合同数查询
    @Select("select count(*) from contract ")
    int totalContracts();

    //查看按钮功能
    ContractBean checkOne(@Param("c") ContractBean contractBean);


}
